package net.stogi.common.gwt.frame.client.core.impl;

import java.util.HashMap;
import java.util.Map;

import net.stogi.common.gwt.frame.client.core.CacheManager;

/**
 * Basic implementation of {@link CacheManager} based on {@link HashMap}.
 * 
 * @author Michał Stogowski
 */
public class BasicCacheManagerImpl implements CacheManager {

	private final Map<String, Object> cacheMap;

	public BasicCacheManagerImpl() {
		cacheMap = new HashMap<String, Object>();
	}

	@Override
	public void clear() {
		cacheMap.clear();
	}

	@Override
	public boolean containsKey(String key) {
		return cacheMap.containsKey(key);
	}

	@Override
	public Object get(String key) {
		return cacheMap.get(key);
	}

	@Override
	public void put(String key, Object value) {
		cacheMap.put(key, value);
	}

	@Override
	public void remove(String key) {
		cacheMap.remove(key);
	}
}
